package com.contacts.taopiaopiao;

import android.util.Log;

/**
 * Created by zuo on 2018/3/30.
 */

public class OneService extends BaseService{
    private Thread mThread;
    int i=0;
    private static final String TAG = OneService.class.getSimpleName();
    @Override
    public void onCreate() {
        super.onCreate();
        mThread = new Thread(){

            @Override
            public void run() {
                while (true) {
                    Log.i(TAG, "run: "+(i++));
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        mThread.start();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        //停止线程
        mThread.interrupt();
    }
}
